﻿#region zh-CHS 2006 - 2007 DemoSoft 团队 | en 2006 - 2007 DemoSoft Team

//     NOTES
// ---------------
//
// This file is a part of the MMOSE(Massively Multiplayer Online Server Engine) for .NET.
//
//                              2006-2007 DemoSoft Team
//
//
// First Version : by H.Q.Cai - mailto:caihuanqing@hotmail.com

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation; either version 2.1 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

#region zh-CHS 包含名字空间 | en Include namespace
using System;
using System.Text;
using System.Threading;
using System.Reflection;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Demo.Mmose.Core.Map;
using Demo.Mmose.Core.Util;
using Demo.Mmose.Core.Item;
using Demo.Mmose.Core.Guild;
using Demo.Mmose.Core.World;
using Demo.Mmose.Core.Common;
using Demo.Mmose.Core.Network;
using Demo.Mmose.Core.Treasure;
using Demo.Mmose.Core.Character;
using Demo.Mmose.Core.Common.Language;
using Demo.Mmose.Core.Common.EventSink;
using Demo.Mmose.Core.Common.Collections;
using Demo.Mmose.Core.Common.SupportSlice;
#endregion

namespace Demo.Mmose.Core.Creature
{
    // 人物的信息
    //////////////////////////////////////////////////////////////////////////
    // 人物的种族
    // 人物的状态
    // 人物的抗性
    // 人物的信息
    // 人物的道具(包裹&身上)

    // 人物的动作
    //////////////////////////////////////////////////////////////////////////
    // 人物的移动
    // 人物的说话
    // 人物用道具
    // 人物的死亡
    // 人物的复活(NPC/怪物-刷出)

    // 人物的AI
    //////////////////////////////////////////////////////////////////////////
    // 人物的AI(移动/说话/攻击/防御/做任务)
    // 人物的普通(攻击/防御)
    // 人物的技能(攻击/增益/诅咒)
    // 人物的魔法(攻击/增益/诅咒)

    // 人物掉落的道具(玩家/NPC-可不掉落)
    // 人物可用的道具
    // 人物可见的范围
    // 
    // 
    // 

    /// <summary>
    /// Base class representing players, npcs, and creatures.
    /// </summary>
    public abstract class BaseCreature : GameEntity, IEntity, IComparable, IComparable<BaseCreature>, ISupportSlice
    {
        #region zh-CHS 构造和初始化和清理 | en Constructors and Initializers and Dispose
        /// <summary>
        /// 默认构造函数
        /// </summary>
        public BaseCreature()
        {
            DefaultCreatureInit();
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="serial">唯一序号</param>
        public BaseCreature( Serial serial )
        {
            m_Serial = serial;
            DefaultCreatureInit();
        }

        #region zh-CHS 人物的初始化 | en
        /// <summary>
        /// 缺省的初始化人物
        /// </summary>
        protected virtual void DefaultCreatureInit()
        {
        }
        #endregion

        #endregion

        #region zh-CHS 共有属性 | en Public Properties

        #region zh-CHS Serial属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物所定义的唯一序号GUID
        /// </summary>
        private Serial m_Serial = Serial.Zero;
        #endregion
        /// <summary>
        /// 人物所定义的唯一序号GUID
        /// </summary>
        public Serial Serial
        {
            get { return m_Serial; }
            set
            {
                Serial oldValueSerial = m_Serial;

                EventHandler<BeforeUpdateSerialEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeUpdateSerial;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeUpdateSerialEventArgs eventArgs = new BeforeUpdateSerialEventArgs( value, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return;
                }

                m_Serial = value;
                m_BaseCreatureState.UpdateSerial();

                EventHandler<AfterUpdateSerialEventArgs> tempAfterEventArgs = m_ThreadEventAfterUpdateSerial;
                if ( tempAfterEventArgs != null )
                {
                    AfterUpdateSerialEventArgs eventArgs = new AfterUpdateSerialEventArgs( oldValueSerial, this );
                    tempAfterEventArgs( this, eventArgs );
                }
            }
        }

        #endregion

        #region zh-CHS X属性 | en Public Properties

        /// <summary>
        /// 人物所在的X坐标点
        /// </summary>
        public float X
        {
            get { return m_Location.X; }
            set
            {
                float oldX = m_Location.X;

                EventHandler<BeforeUpdateXEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeUpdateX;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeUpdateXEventArgs eventArgs = new BeforeUpdateXEventArgs( value, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return;
                }

                m_Location.X = value;
                m_BaseCreatureState.UpdateX();

                EventHandler<AfterUpdateXEventArgs> tempAfterEventArgs = m_ThreadEventAfterUpdateX;
                if ( tempAfterEventArgs != null )
                {
                    AfterUpdateXEventArgs eventArgs = new AfterUpdateXEventArgs( oldX, this );
                    tempAfterEventArgs( this, eventArgs );
                }
            }
        }

        #endregion

        #region zh-CHS Y属性 | en Public Properties

        /// <summary>
        /// 人物所在的Y坐标点
        /// </summary>
        public float Y
        {
            get { return m_Location.Y; }
            set
            {
                float oldY = m_Location.Y;

                EventHandler<BeforeUpdateYEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeUpdateY;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeUpdateYEventArgs eventArgs = new BeforeUpdateYEventArgs( value, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return;
                }

                m_Location.Y = value;
                m_BaseCreatureState.UpdateY();

                EventHandler<AfterUpdateYEventArgs> tempAfterEventArgs = m_ThreadEventAfterUpdateY;
                if ( tempAfterEventArgs != null )
                {
                    AfterUpdateYEventArgs eventArgs = new AfterUpdateYEventArgs( oldY, this );
                    tempAfterEventArgs( this, eventArgs );
                }
            }
        }

        #endregion

        #region zh-CHS Z属性 | en Public Properties

        /// <summary>
        /// 人物所在的Z坐标点
        /// </summary>
        public float Z
        {
            get { return m_Location.Z; }
            set
            {
                float oldZ = m_Location.Z;

                EventHandler<BeforeUpdateZEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeUpdateZ;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeUpdateZEventArgs eventArgs = new BeforeUpdateZEventArgs( value, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return;
                }

                m_Location.Z = value;
                m_BaseCreatureState.UpdateZ();

                EventHandler<AfterUpdateZEventArgs> tempAfterEventArgs = m_ThreadEventAfterUpdateZ;
                if ( tempAfterEventArgs != null )
                {
                    AfterUpdateZEventArgs eventArgs = new AfterUpdateZEventArgs( oldZ, this );
                    tempAfterEventArgs( this, eventArgs );
                }
            }
        }

        #endregion

        #region zh-CHS Orientation属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物所面向的方向
        /// </summary>
        private float m_Orientation;
        #endregion
        /// <summary>
        /// 人物所面向的方向
        /// </summary>
        public float Orientation
        {
            get { return m_Orientation; }
            set
            {
                float oldOrientation = m_Orientation;

                EventHandler<BeforeUpdateOrientationEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeUpdateOrientation;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeUpdateOrientationEventArgs eventArgs = new BeforeUpdateOrientationEventArgs( value, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return;
                }

                m_Orientation = value;
                m_BaseCreatureState.UpdateOrientation();

                EventHandler<AfterUpdateOrientationEventArgs> tempAfterEventArgs = m_ThreadEventAfterUpdateOrientation;
                if ( tempAfterEventArgs != null )
                {
                    AfterUpdateOrientationEventArgs eventArgs = new AfterUpdateOrientationEventArgs( oldOrientation, this );
                    tempAfterEventArgs( this, eventArgs );
                }
            }
        }

        #endregion

        #region zh-CHS Location属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物所在地图的位置
        /// </summary>
        private Point3D m_Location = Point3D.Zero;
        #endregion
        /// <summary>
        /// 人物所在地图的位置
        /// </summary>
        public Point3D Location
        {
            get { return m_Location; }
            set
            {
                Point3D oldLocation = m_Location;

                EventHandler<BeforeUpdateLocationEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeUpdateLocation;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeUpdateLocationEventArgs eventArgs = new BeforeUpdateLocationEventArgs( value, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return;
                }

                m_Location = value;
                m_BaseCreatureState.UpdateLocation();

                EventHandler<AfterUpdateLocationEventArgs> tempAfterEventArgs = m_ThreadEventAfterUpdateLocation;
                if ( tempAfterEventArgs != null )
                {
                    AfterUpdateLocationEventArgs eventArgs = new AfterUpdateLocationEventArgs( oldLocation, this );
                    tempAfterEventArgs( this, eventArgs );
                }
            }
        }

        #region zh-CHS 内部保护方法 | en Protected Internal Methods
        /// <summary>
        /// 地图点激活(表示当前附近有玩家存在，需要激活怪物的AI)
        /// </summary>
        protected internal virtual void OnSpaceNodeActivate()
        {
        }

        /// <summary>
        /// 地图点不激活(表示当前附近没有玩家存在，不需要激活怪物的AI)
        /// </summary>
        protected internal virtual void OnSpaceNodeDeactivate()
        {
        }
        #endregion

        #region zh-CHS 人物的移动 | en
        /// <summary>
        /// 人物的移动方向
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        public bool MoveTo( Point3D newLocation )
        {
            BaseMap tempBaseMap = m_BaseMap; // 副本防止多线程置空
            if ( m_Deleted == true || tempBaseMap == null )
                return false;

            MoveToEventArgs outEventArgs = EventSink.BaseCharacter.InvokeMoveTo( this, newLocation );
            if ( outEventArgs != null )
                if ( outEventArgs.Blocked == true )
                    return false;

            Point3D oldLocation = m_Location;

            EventHandler<BeforeMoveToCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeMoveToCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeMoveToCallEventArgs eventArgs = new BeforeMoveToCallEventArgs( newLocation, this );
                tempBeforeEventArgs( this, eventArgs );

                if ( eventArgs.IsCancel == true )
                    return false;
            }

            m_Location = newLocation; // 直接设置

            tempBaseMap.OnMove( oldLocation, this );

            m_BaseCreatureState.UpdateMoveToCall();

            EventHandler<AfterMoveToCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterMoveToCall;
            if ( tempAfterEventArgs != null )
            {
                AfterMoveToCallEventArgs eventArgs = new AfterMoveToCallEventArgs( oldLocation, this );
                tempAfterEventArgs( this, eventArgs );
            }

            return true;
        }

        /// <summary>
        /// 移动到世界的某地图的某个点
        /// </summary>
        /// <param name="newLocation"></param>
        /// <param name="map"></param>
        public bool MoveToWorld( Point3D newLocation, BaseMap newBaseMap )
        {
            BaseMap tempBaseMap = m_BaseMap; // 副本防止多线程置空
            if ( m_Deleted || tempBaseMap == null || newBaseMap == null )
                return false;

            MoveToWorldEventArgs outEventArgs = EventSink.BaseCharacter.InvokeMoveToWorld( this, newLocation, newBaseMap );
            if ( outEventArgs != null )
                if ( outEventArgs.Blocked == true )
                    return false;

            if ( m_BaseMap == newBaseMap )
                return MoveTo( newLocation );
            else
            {
                BaseMap oldBaseMap = m_BaseMap;
                Point3D oldLocation = m_Location;

                EventHandler<BeforeMoveToWorldCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeMoveToWorldCall;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeMoveToWorldCallEventArgs eventArgs = new BeforeMoveToWorldCallEventArgs( newLocation, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return false;
                }

                m_BaseMap = newBaseMap; // 直接设置
                m_Location = newLocation; // 直接设置

                oldBaseMap.OnLeave( this );
                m_BaseMap.OnEnter( this );

                m_BaseCreatureState.UpdateMoveToWorldCall();

                EventHandler<AfterMoveToWorldCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterMoveToWorldCall;
                if ( tempAfterEventArgs != null )
                {
                    AfterMoveToWorldCallEventArgs eventArgs = new AfterMoveToWorldCallEventArgs( oldLocation, this );
                    tempAfterEventArgs( this, eventArgs );
                }

                return true;
            }
        }
        #endregion

        #endregion

        #region zh-CHS Map属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物所在的地图
        /// </summary>
        private BaseMap m_BaseMap = null;
        #endregion
        /// <summary>
        /// 人物所在的地图
        /// </summary>
        public BaseMap Map
        {
            get { return m_BaseMap; }
            set
            {
                BaseMap oldBaseMap = m_BaseMap;

                EventHandler<BeforeUpdateMapEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeUpdateMap;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeUpdateMapEventArgs eventArgs = new BeforeUpdateMapEventArgs( value, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return;
                }

                m_BaseMap = value;
                m_BaseCreatureState.UpdateMap();

                EventHandler<AfterUpdateMapEventArgs> tempAfterEventArgs = m_ThreadEventAfterUpdateMap;
                if ( tempAfterEventArgs != null )
                {
                    AfterUpdateMapEventArgs eventArgs = new AfterUpdateMapEventArgs( oldBaseMap, this );
                    tempAfterEventArgs( this, eventArgs );
                }
            }
        }

        #endregion

        #region zh-CHS Name属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物的名字
        /// </summary>
        private string m_Name = string.Empty;
        #endregion
        /// <summary>
        /// 人物的名字
        /// </summary>
        public string Name
        {
            get { return m_Name; }
            set
            {
                string oldName = m_Name;

                EventHandler<BeforeUpdateNameEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeUpdateName;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeUpdateNameEventArgs eventArgs = new BeforeUpdateNameEventArgs( value, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return;
                }

                m_Name = value;
                m_BaseCreatureState.UpdateName();

                EventHandler<AfterUpdateNameEventArgs> tempAfterEventArgs = m_ThreadEventAfterUpdateName;
                if ( tempAfterEventArgs != null )
                {
                    AfterUpdateNameEventArgs eventArgs = new AfterUpdateNameEventArgs( oldName, this );
                    tempAfterEventArgs( this, eventArgs );
                }
            }
        }

        #endregion

        #region zh-CHS CreatureTemplate属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物的帐号等级
        /// </summary>
        private BaseCreatureTemplate m_CreatureTemplate = null;
        #endregion
        /// <summary>
        /// 人物的帐号等级
        /// </summary>
        public BaseCreatureTemplate CreatureTemplate
        {
            get { return m_CreatureTemplate; }
            set
            {
                BaseCreatureTemplate oldCreatureTemplate = m_CreatureTemplate;

                EventHandler<BeforeUpdateCreatureTemplateEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeUpdateCreatureTemplate;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeUpdateCreatureTemplateEventArgs eventArgs = new BeforeUpdateCreatureTemplateEventArgs( value, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return;
                }

                m_CreatureTemplate = value;
                m_BaseCreatureState.UpdateCreatureTemplate();

                EventHandler<AfterUpdateCreatureTemplateEventArgs> tempAfterEventArgs = m_ThreadEventAfterUpdateCreatureTemplate;
                if ( tempAfterEventArgs != null )
                {
                    AfterUpdateCreatureTemplateEventArgs eventArgs = new AfterUpdateCreatureTemplateEventArgs( oldCreatureTemplate, this );
                    tempAfterEventArgs( this, eventArgs );
                }
            }
        }

        #endregion

        #region zh-CHS Alive属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物是否在活着(true)或死亡(false)
        /// </summary>
        private bool m_Alive = true;
        #endregion
        /// <summary>
        /// 人物是否在活着(true)或死亡(false)
        /// </summary>
        public virtual bool Alive
        {
            get { return m_Alive; }
        }

        #region zh-CHS 人物的死亡(Player/NPC/Monster) | en
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public bool Death()
        {
            return Death( null );
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="mobileKiller"></param>
        /// <returns></returns>
        public bool Death( BaseCreature creatureKiller )
        {
            if ( m_Deleted == true && m_Alive == false )
                return false;

            EventHandler<BeforeDeathCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeDeathCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeDeathCallEventArgs eventArgs = new BeforeDeathCallEventArgs( creatureKiller, this );
                tempBeforeEventArgs( this, eventArgs );

                if ( eventArgs.IsCancel == true )
                    return false;
            }

            m_Alive = false;

            m_BaseCreatureState.UpdateDeathCall();

            EventHandler<AfterDeathCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterDeathCall;
            if ( tempAfterEventArgs != null )
            {
                AfterDeathCallEventArgs eventArgs = new AfterDeathCallEventArgs( creatureKiller, this );
                tempAfterEventArgs( this, eventArgs );
            }

            return true;
        }
        #endregion

        #region zh-CHS 人物的复活(Player/NPC/Monster-刷出) | en

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public bool Revival()
        {
            return Revival( null );
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="mobileResurrect"></param>
        /// <returns></returns>
        public bool Revival( BaseCreature creatureRevival )
        {
            if ( m_Deleted && m_Alive == true )
                return false;

            EventHandler<BeforeRevivalCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeRevivalCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeRevivalCallEventArgs eventArgs = new BeforeRevivalCallEventArgs( creatureRevival, this );
                tempBeforeEventArgs( this, eventArgs );

                if ( eventArgs.IsCancel == true )
                    return false;
            }

            m_Alive = true;

            m_BaseCreatureState.UpdateRevivalCall();

            EventHandler<AfterRevivalCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterRevivalCall;
            if ( tempAfterEventArgs != null )
            {
                AfterRevivalCallEventArgs eventArgs = new AfterRevivalCallEventArgs( creatureRevival, this );
                tempAfterEventArgs( this, eventArgs );
            }

            return true;
        }

        #endregion

        #endregion

        #region zh-CHS CreationTime 属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物实例产生的时间
        /// </summary>
        private DateTime m_CreationTime = DateTime.Now;
        #endregion
        /// <summary>
        /// 实例人物时产生的时间
        /// </summary>
        public DateTime CreationTime
        {
            get { return m_CreationTime; }
        }

        #endregion

        #region zh-CHS Loots属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        BaseTreasure[] m_Loots = null;
        #endregion
        /// <summary>
        /// 随机掉落的道具
        /// </summary>
        public BaseTreasure[] Loots
        {
            get { return m_Loots; }
            set
            {
                BaseTreasure[] oldLoots = m_Loots;

                EventHandler<BeforeUpdateLootsEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeUpdateLoots;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeUpdateLootsEventArgs eventArgs = new BeforeUpdateLootsEventArgs( value, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return;
                }

                m_Loots = value;

                m_BaseCreatureState.UpdateLoots();

                EventHandler<AfterUpdateLootsEventArgs> tempAfterEventArgs = m_ThreadEventAfterUpdateLoots;
                if ( tempAfterEventArgs != null )
                {
                    AfterUpdateLootsEventArgs eventArgs = new AfterUpdateLootsEventArgs( oldLoots, this );
                    tempAfterEventArgs( this, eventArgs );
                }
            }
        }

        #region zh-CHS 共有方法 | en Public Methods

        /// <summary>
        /// 开始掉落随机的道具
        /// </summary>
        /// <returns></returns>
        public BaseItem[] GenerateLoot()
        {
            if ( m_Loots == null )
                return null;

            List<BaseItem> baseTreasureList = new List<BaseItem>( BaseTreasure.DROP_CACHED_SIZE );

            foreach ( BaseTreasure baseTreasure in m_Loots )
            {
                if ( baseTreasure.IsDrop() )
                {
                    BaseItem[] baseItemArray = baseTreasure.RandomDrop();
                    if ( baseItemArray != null )
                        baseTreasureList.AddRange( baseItemArray );
                }
            }

            if ( baseTreasureList.Count <= 0 )
                return null;
            else
                return baseTreasureList.ToArray();
        }

        #endregion

        #endregion

        #region zh-CHS GoldLoots属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        BaseTreasure[] m_GoldLoots = null;
        #endregion
        /// <summary>
        /// 随机掉落的道具
        /// </summary>
        public BaseTreasure[] GoldLoots
        {
            get { return m_GoldLoots; }
            set
            {
                BaseTreasure[] oldGoldLoots = m_GoldLoots;

                EventHandler<BeforeUpdateGoldLootsEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeUpdateGoldLoot;
                if ( tempBeforeEventArgs != null )
                {
                    BeforeUpdateGoldLootsEventArgs eventArgs = new BeforeUpdateGoldLootsEventArgs( value, this );
                    tempBeforeEventArgs( this, eventArgs );

                    if ( eventArgs.IsCancel == true )
                        return;
                }

                m_GoldLoots = value;

                m_BaseCreatureState.UpdateGoldLoots();

                EventHandler<AfterUpdateGoldLootsEventArgs> tempAfterEventArgs = m_ThreadEventAfterUpdateGoldLoots;
                if ( tempAfterEventArgs != null )
                {
                    AfterUpdateGoldLootsEventArgs eventArgs = new AfterUpdateGoldLootsEventArgs( oldGoldLoots, this );
                    tempAfterEventArgs( this, eventArgs );
                }
            }
        }

        #region zh-CHS 共有方法 | en Public Methods

        /// <summary>
        /// 开始掉落随机的道具
        /// </summary>
        /// <returns></returns>
        public GoldItem[] GenerateGoldLoot()
        {
            if ( m_GoldLoots == null )
                return null;

            List<GoldItem> baseTreasureList = new List<GoldItem>( BaseTreasure.DROP_CACHED_SIZE );

            foreach ( BaseTreasure baseTreasure in m_Loots )
            {
                if ( baseTreasure.IsDrop() )
                {
                    GoldItem[] goldItemArray = baseTreasure.RandomGoldDrop();
                    if ( goldItemArray != null )
                        baseTreasureList.AddRange( goldItemArray );
                }
            }

            if ( baseTreasureList.Count <= 0 )
                return null;
            else
                return baseTreasureList.ToArray();
        }

        #endregion

        #endregion

        #region zh-CHS Deleted属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物是否删除
        /// </summary>
        private bool m_Deleted = false;
        #endregion
        /// <summary>
        /// BaseMobile是否已无效删除
        /// </summary>
        public bool Deleted
        {
            get { return m_Deleted; }
        }

        #region zh-CHS 人物的删除 | en
        /// <summary>
        /// 删除
        /// </summary>
        public void DeleteCreature()
        {
            EventHandler<BaseCreatureEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeDeleteCall;
            if ( tempBeforeEventArgs != null )
            {
                BaseCreatureEventArgs eventArgs = new BaseCreatureEventArgs( this );
                tempBeforeEventArgs( this, eventArgs );
            }

            m_Deleted = true;

            EventHandler<BaseCreatureEventArgs> tempAfterEventArgs = m_ThreadEventAfterDeleteCall;
            if ( tempAfterEventArgs != null )
            {
                BaseCreatureEventArgs eventArgs = new BaseCreatureEventArgs( this );
                tempAfterEventArgs( this, eventArgs );
            }

        }
        #endregion

        #endregion

        #region zh-CHS 道具列表 属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物的道具列表
        /// </summary>
        private SafeDictionary<long, BaseItem> m_ToteItems = new SafeDictionary<long, BaseItem>();
        #endregion
        /// <summary>
        /// 人物的道具列表(包裹与身上)
        /// </summary>
        /// <returns></returns>
        [MultiThreadedWarning( "zh-CHS", "(道具)当前的数组是列表临时产生的,不能保存数组用于以后操作:警告!" )]
        public BaseItem[] ItemsToArray()
        {
            return m_ToteItems.ToArrayValues();
        }

        #region zh-CHS 共有方法 | en Public Methods

        /// <summary>
        /// 添加道具
        /// </summary>
        /// <param name="item"></param>
        public bool AddItem( long iItemSerial, BaseItem baseItem )
        {
            if ( baseItem == null )
            {
                Debug.WriteLine( "BaseCreature.AddItem(...) - baseItem == null error!" );

                return false;
            }

            if ( m_Deleted == true )
                return false;

            EventHandler<BeforeAddItemCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeAddItemCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeAddItemCallEventArgs eventArgs = new BeforeAddItemCallEventArgs( baseItem, this );
                tempBeforeEventArgs( this, eventArgs );

                if ( eventArgs.IsCancel == true )
                    return false;
            }

            m_ToteItems.Add( iItemSerial, baseItem );

            m_BaseCreatureState.UpdateAddItemCall();

            EventHandler<AfterAddItemCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterAddItemCall;
            if ( tempAfterEventArgs != null )
            {
                AfterAddItemCallEventArgs eventArgs = new AfterAddItemCallEventArgs( baseItem, this );
                tempAfterEventArgs( this, eventArgs );
            }

            return true;
        }

        /// <summary>
        /// 移出道具
        /// </summary>
        /// <param name="item"></param>
        public bool RemoveItem( long iItemSerial )
        {
            if ( m_Deleted == true )
                return false;

            BaseItem baseItem = FindItemOnSerial( iItemSerial );
            if ( baseItem == null )
                return false;

            EventHandler<BeforeRemoveItemCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeRemoveItemCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeRemoveItemCallEventArgs eventArgs = new BeforeRemoveItemCallEventArgs( baseItem, this );
                tempBeforeEventArgs( this, eventArgs );

                if ( eventArgs.IsCancel == true )
                    return false;
            }

            m_ToteItems.Remove( iItemSerial );

            m_BaseCreatureState.UpdateRemoveItemCall();

            EventHandler<AfterRemoveItemCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterRemoveItemCall;
            if ( tempAfterEventArgs != null )
            {
                AfterRemoveItemCallEventArgs eventArgs = new AfterRemoveItemCallEventArgs( baseItem, this );
                tempAfterEventArgs( this, eventArgs );
            }

            return true;
        }

        /// <summary>
        /// 在身上找道具
        /// </summary>
        /// <param name="layer"></param>
        /// <returns></returns>
        public BaseItem FindItemOnSerial( long iItemSerial )
        {
            return m_ToteItems.GetValue( iItemSerial );
        }

        #endregion

        #endregion

        #region zh-CHS 好友列表 方法 | en Friend Method

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 好友的集合
        /// </summary>
        private SafeDictionary<long, BaseCreature> m_BaseCreaturesFriend = new SafeDictionary<long, BaseCreature>();
        #endregion
        /// <summary>
        /// 全部好友的数组
        /// </summary>
        /// <returns></returns>
        [MultiThreadedWarning( "zh-CHS", "(好友)当前的数组是列表临时产生的,不能保存数组用于以后操作:警告!" )]
        public BaseCreature[] FriendToArray()
        {
            return m_BaseCreaturesFriend.ToArrayValues();
        }

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 添加好友到集合
        /// </summary>
        public bool AddFriend( Serial iCreatureSerial, BaseCreature baseCreature )
        {
            if ( baseCreature == null )
            {
                Debug.WriteLine( "BaseCreature.AddFriend(...) - baseCreature == null error!" );

                return false;
            }

            if ( m_Deleted == true )
                return false;

            EventHandler<BeforeAddFriendCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeAddFriendCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeAddFriendCallEventArgs eventArgs = new BeforeAddFriendCallEventArgs( baseCreature, this );
                tempBeforeEventArgs( this, eventArgs );

                if ( eventArgs.IsCancel == true )
                    return false;
            }

            m_BaseCreaturesFriend.Add( iCreatureSerial, baseCreature );

            m_BaseCreatureState.UpdateAddFriendCall();

            EventHandler<AfterAddFriendCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterAddFriendCall;
            if ( tempAfterEventArgs != null )
            {
                AfterAddFriendCallEventArgs eventArgs = new AfterAddFriendCallEventArgs( baseCreature, this );
                tempAfterEventArgs( this, eventArgs );
            }

            return true;
        }

        /// <summary>
        /// 在好友的集合内删除某好友
        /// </summary>
        /// <param name="iCreatureSerial"></param>
        public bool RemoveFriend( long iCreatureSerial )
        {
            if ( m_Deleted == true )
                return false;

            BaseCreature baseCreature = FindFriendOnSerial( iCreatureSerial );
            if ( baseCreature == null )
                return false;

            EventHandler<BeforeRemoveFriendCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeRemoveFriendCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeRemoveFriendCallEventArgs eventArgs = new BeforeRemoveFriendCallEventArgs( baseCreature, this );
                tempBeforeEventArgs( this, eventArgs );

                if ( eventArgs.IsCancel == true )
                    return false;
            }

            m_BaseCreaturesFriend.Remove( iCreatureSerial );

            m_BaseCreatureState.UpdateRemoveFriendCall();

            EventHandler<AfterRemoveFriendCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterRemoveFriendCall;
            if ( tempAfterEventArgs != null )
            {
                AfterRemoveFriendCallEventArgs eventArgs = new AfterRemoveFriendCallEventArgs( baseCreature, this );
                tempAfterEventArgs( this, eventArgs );
            }

            return true;
        }

        /// <summary>
        /// 在好友的集合内给出某好友
        /// </summary>
        /// <param name="iCreatureSerial"></param>
        /// <returns></returns>
        public BaseCreature FindFriendOnSerial( long iCreatureSerial )
        {
            return m_BaseCreaturesFriend.GetValue( iCreatureSerial );
        }
        #endregion

        #endregion

        #region zh-CHS 组队列表 方法 | en Group Method

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 好友的集合
        /// </summary>
        private SafeDictionary<long, BaseCreature> m_BaseCreaturesGroup = new SafeDictionary<long, BaseCreature>();
        #endregion
        /// <summary>
        /// 全部好友的数组
        /// </summary>
        /// <returns></returns>
        [MultiThreadedWarning( "zh-CHS", "(组队)当前的数组是列表临时产生的,不能保存数组用于以后操作:警告!" )]
        public BaseCreature[] GroupToArray()
        {
            return m_BaseCreaturesGroup.ToArrayValues();
        }

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 添加好友到集合
        /// </summary>
        public bool AddGroup( Serial iCreatureSerial, BaseCreature baseCreature )
        {
            if ( baseCreature == null )
            {
                Debug.WriteLine( "BaseCreature.AddGroup(...) - baseCreature == null error!" );

                return false;
            }

            if ( m_Deleted == true )
                return false;

            EventHandler<BeforeAddGroupCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeAddGroupCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeAddGroupCallEventArgs eventArgs = new BeforeAddGroupCallEventArgs( baseCreature, this );
                tempBeforeEventArgs( this, eventArgs );

                if ( eventArgs.IsCancel == true )
                    return false;
            }

            m_BaseCreaturesGroup.Add( iCreatureSerial, baseCreature );

            m_BaseCreatureState.UpdateAddGroupCall();

            EventHandler<AfterAddGroupCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterAddGroupCall;
            if ( tempAfterEventArgs != null )
            {
                AfterAddGroupCallEventArgs eventArgs = new AfterAddGroupCallEventArgs( baseCreature, this );
                tempAfterEventArgs( this, eventArgs );
            }

            return true;
        }

        /// <summary>
        /// 在好友的集合内删除某好友
        /// </summary>
        /// <param name="iMapID"></param>
        public bool RemoveGroup( long iCreatureSerial )
        {
            if ( m_Deleted == true )
                return false;

            BaseCreature baseCreature = FindGroupOnSerial( iCreatureSerial );
            if ( baseCreature == null )
                return false;

            EventHandler<BeforeRemoveGroupCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeRemoveGroupCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeRemoveGroupCallEventArgs eventArgs = new BeforeRemoveGroupCallEventArgs( baseCreature, this );
                tempBeforeEventArgs( this, eventArgs );

                if ( eventArgs.IsCancel == true )
                    return false;
            }

            m_BaseCreaturesGroup.Remove( iCreatureSerial );

            m_BaseCreatureState.UpdateRemoveGroupCall();

            EventHandler<AfterRemoveGroupCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterRemoveGroupCall;
            if ( tempAfterEventArgs != null )
            {
                AfterRemoveGroupCallEventArgs eventArgs = new AfterRemoveGroupCallEventArgs( baseCreature, this );
                tempAfterEventArgs( this, eventArgs );
            }

            return true;
        }

        /// <summary>
        /// 在好友的集合内给出某好友
        /// </summary>
        /// <param name="iMapID"></param>
        /// <returns></returns>
        public BaseCreature FindGroupOnSerial( long iCreatureSerial )
        {
            return m_BaseCreaturesGroup.GetValue( iCreatureSerial );
        }
        #endregion

        #endregion

        #region zh-CHS 团体列表 方法 | en Party Method

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 好友的集合
        /// </summary>
        private SafeDictionary<long, BaseCreature> m_BaseCreaturesParty = new SafeDictionary<long, BaseCreature>();
        #endregion
        /// <summary>
        /// 全部好友的数组
        /// </summary>
        /// <returns></returns>
        [MultiThreadedWarning( "zh-CHS", "(团队)当前的数组是列表临时产生的,不能保存数组用于以后操作:警告!" )]
        public BaseCreature[] PartyToArray()
        {
            return m_BaseCreaturesParty.ToArrayValues();
        }

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 添加好友到集合
        /// </summary>
        public bool AddParty( Serial iCreatureSerial, BaseCreature baseCreature )
        {
            if ( baseCreature == null )
            {
                Debug.WriteLine( "BaseCreature.AddParty(...) - baseCreature == null error!" );

                return false;
            }

            if ( m_Deleted == true )
                return false;

            EventHandler<BeforeAddPartyCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeAddPartyCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeAddPartyCallEventArgs eventArgs = new BeforeAddPartyCallEventArgs( baseCreature, this );
                tempBeforeEventArgs( this, eventArgs );

                if ( eventArgs.IsCancel == true )
                    return false;
            }

            m_BaseCreaturesParty.Add( baseCreature.Serial, baseCreature );

            m_BaseCreatureState.UpdateAddPartyCall();

            EventHandler<AfterAddPartyCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterAddPartyCall;
            if ( tempAfterEventArgs != null )
            {
                AfterAddPartyCallEventArgs eventArgs = new AfterAddPartyCallEventArgs( baseCreature, this );
                tempAfterEventArgs( this, eventArgs );
            }

            return true;
        }

        /// <summary>
        /// 在好友的集合内删除某好友
        /// </summary>
        /// <param name="iMapID"></param>
        public bool RemoveParty( long iCreatureSerial )
        {
            if ( m_Deleted == true )
                return false;

            BaseCreature baseCreature = FindPartyOnSerial( iCreatureSerial );
            if ( baseCreature == null )
                return false;

            EventHandler<BeforeRemovePartyCallEventArgs> tempBeforeEventArgs = m_ThreadEventBeforeRemovePartyCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeRemovePartyCallEventArgs eventArgs = new BeforeRemovePartyCallEventArgs( baseCreature, this );
                tempBeforeEventArgs( this, eventArgs );

                if ( eventArgs.IsCancel == true )
                    return false;
            }

            m_BaseCreaturesParty.Remove( iCreatureSerial );

            m_BaseCreatureState.UpdateRemovePartyCall();

            EventHandler<AfterRemovePartyCallEventArgs> tempAfterEventArgs = m_ThreadEventAfterRemovePartyCall;
            if ( tempAfterEventArgs != null )
            {
                AfterRemovePartyCallEventArgs eventArgs = new AfterRemovePartyCallEventArgs( baseCreature, this );
                tempAfterEventArgs( this, eventArgs );
            }

            return true;
        }

        /// <summary>
        /// 在好友的集合内给出某好友
        /// </summary>
        /// <param name="iCreatureSerial"></param>
        /// <returns></returns>
        public BaseCreature FindPartyOnSerial( long iCreatureSerial )
        {
            return m_BaseCreaturesParty.GetValue( iCreatureSerial );
        }

        #endregion

        #endregion

        #region zh-CHS Saving属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_Saving = false;
        #endregion
        /// <summary>
        /// 是否正在存储数据中
        /// </summary>
        public bool Saving
        {
            get { return m_Saving; }
        }

        #region zh-CHS 共有方法 | en Public Methods
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockSave = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 保存人物的数据
        /// </summary>
        public void Save()
        {
            // 移动物体的数据必须要成功才返回
            ReaderWriterLockSlimEx.EnterWriteLock( m_LockSave );
            {
                // 保存数据中......
                m_Saving = true;

                EventHandler<BaseCreatureEventArgs> tempEventArgs = m_ThreadEventCreatureSave;
                // 保存数据
                if ( tempEventArgs != null )
                {
                    LOGs.WriteLine( LogMessageType.MSG_NOTICE, LanguageString.SingletonInstance.BaseCreatureString001, m_Name );

                    BaseCreatureEventArgs eventArgs = new BaseCreatureEventArgs( this );
                    tempEventArgs( this, eventArgs );

                    LOGs.WriteLine( LogMessageType.MSG_NOTICE, LanguageString.SingletonInstance.BaseCreatureString002, m_Name );
                }

                // 保存数据结束......
                m_Saving = false;
            }
            ReaderWriterLockSlimEx.ExitWriteLock( m_LockSave );
        }
        #endregion

        #endregion

        #region zh-CHS CreatureState属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物的状态机
        /// </summary>
        private BaseCreatureState m_BaseCreatureState = new BaseCreatureState();
        #endregion
        /// <summary>
        /// BaseCreatureState人物的状态器
        /// </summary>
        public BaseCreatureState BaseCreatureState
        {
            get { return m_BaseCreatureState; }
        }

        #endregion

        #region zh-CHS BaseWorld属性 | en BaseWorld Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 管理当前的世界服务
        /// </summary>
        private BaseWorld m_BaseWorld = null;
        #endregion
        /// <summary>
        /// 管理当前的世界服务
        /// </summary>
        public BaseWorld BaseWorld
        {
            get { return m_BaseWorld; }
            internal set { m_BaseWorld = value; }
        }

        #endregion

        #region zh-CHS MapSpaceNode属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private MapSpaceNode m_MapSpaceNode = null;
        #endregion
        /// <summary>
        /// 用于内部使用的地图点
        /// </summary>
        public MapSpaceNode MapSpaceNode
        {
            get { return m_MapSpaceNode; }
            internal set { m_MapSpaceNode = value; }
        }

        #endregion

        #region zh-CHS IArtificialIntelligence属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private IArtificialIntelligence m_ArtificialIntelligence = null;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public IArtificialIntelligence AI
        {
            get { return m_ArtificialIntelligence; }
            set { m_ArtificialIntelligence = value; }
        }

        #endregion

        #endregion

        #region zh-CHS 共有方法 | en Public Methods

        #region zh-CHS 人物可见的范围 | en

        #region zh-CHS 给出目标的距离 | en
        /// <summary>
        /// 给出目标的距离
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public double GetDistanceToSqrt( BaseCreature baseMobile )
        {
            if ( baseMobile == null )
            {
                Debug.WriteLine( "BaseMobile.GetDistanceToSqrt(...) - baseMobile == null error!" );

                return 0.0f;
            }

            return GetDistanceToSqrt( baseMobile as IPoint2D );
        }

        /// <summary>
        /// 给出目标的距离
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public double GetDistanceToSqrt( BaseItem baseItem )
        {
            if ( baseItem == null )
            {
                Debug.WriteLine( "BaseMobile.GetDistanceToSqrt(...) - baseItem == null error!" );

                return 0.0f;
            }

            return GetDistanceToSqrt( baseItem as IPoint2D );
        }

        /// <summary>
        /// 给出目标的距离
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public double GetDistanceToSqrt( Point3D point3D )
        {
            // (防止装箱操作)
            float xDelta = m_Location.X - point3D.X;
            float yDelta = m_Location.Y - point3D.Y;

            return Math.Sqrt( ( xDelta * xDelta ) + ( yDelta * yDelta ) );
        }

        /// <summary>
        /// 给出目标的距离
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public double GetDistanceToSqrt( IPoint3D point3D )
        {
            return GetDistanceToSqrt( point3D as IPoint2D );
        }

        /// <summary>
        /// 给出目标的距离
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public double GetDistanceToSqrt( Point2D point2D )
        {
            // (防止装箱操作)
            float xDelta = m_Location.X - point2D.X;
            float yDelta = m_Location.Y - point2D.Y;

            return Math.Sqrt( ( xDelta * xDelta ) + ( yDelta * yDelta ) );
        }

        /// <summary>
        /// 给出目标的距离
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public double GetDistanceToSqrt( IPoint2D point2D )
        {
            float xDelta = m_Location.X - point2D.X;
            float yDelta = m_Location.Y - point2D.Y;

            return Math.Sqrt( ( xDelta * xDelta ) + ( yDelta * yDelta ) );
        }
        #endregion

        #region zh-CHS 给出人物范围内的道具或人物或对象 | en
        /// <summary>
        /// 给出人物范围内的道具
        /// </summary>
        /// <param name="range"></param>
        /// <returns></returns>
        public IEnumerable<ItemT> GetItemsInRange<ItemT>( int iRange ) where ItemT : BaseItem
        {
            BaseMap tempBaseMap = m_BaseMap;
            if ( tempBaseMap == null )
            {
                Debug.WriteLine( "BaseCreature.GetItemsInRange(...) - m_BaseMap == null error!" );

                return NullEnumerable<ItemT>.Instance;
            }

            return tempBaseMap.GetItemsInRange<ItemT>( m_Location, iRange );
        }

        /// <summary>
        /// 给出人物范围内的人物
        /// </summary>
        /// <param name="range"></param>
        /// <returns></returns>
        public IEnumerable<CreatureT> GetCreatureInRange<CreatureT>( int iRange ) where CreatureT : BaseCreature
        {
            BaseMap tempBaseMap = m_BaseMap;
            if ( tempBaseMap == null )
            {
                Debug.WriteLine( "BaseCreature.GetCreatureInRange(...) - m_BaseMap == null error!" );

                return NullEnumerable<CreatureT>.Instance;
            }

            return tempBaseMap.GetCreaturesInRange<CreatureT>( m_Location, iRange );
        }

        /// <summary>
        /// 给出人物范围内的客户端
        /// </summary>
        /// <param name="range"></param>
        /// <returns></returns>
        public IEnumerable<CharacterT> GetPlayersInRange<CharacterT>( int iRange ) where CharacterT : BaseCharacter
        {
            BaseMap tempBaseMap = m_BaseMap;
            if ( tempBaseMap == null )
            {
                Debug.WriteLine( "BaseCreature.GetClientsInRange(...) - m_BaseMap == null error!" );

                return NullEnumerable<CharacterT>.Instance;
            }

            return tempBaseMap.GetCreaturesInRange<CharacterT>( m_Location, iRange );
        }
        #endregion

        #region zh-CHS 给出人物或道具或位置是否在此人物的范围内 | en
        /// <summary>
        /// 人物是否在范围内
        /// </summary>
        /// <param name="p"></param>
        /// <param name="range"></param>
        /// <returns></returns>
        public bool InRange( BaseCreature baseMobile, int iRange )
        {
            if ( baseMobile == null )
            {
                Debug.WriteLine( "BaseMobile.InRange(...) - baseMobile == null error!" );

                return false;
            }

            return InRange( baseMobile as IPoint2D, iRange );
        }

        /// <summary>
        /// 道具是否在范围内
        /// </summary>
        /// <param name="p"></param>
        /// <param name="range"></param>
        /// <returns></returns>
        public bool InRange( BaseItem baseItem, int iRange )
        {
            if ( baseItem == null )
            {
                Debug.WriteLine( "BaseMobile.InRange(...) - baseItem == null error!" );

                return false;
            }

            return InRange( baseItem as IPoint2D, iRange );
        }

        /// <summary>
        /// 位置是否在范围内
        /// </summary>
        /// <param name="p"></param>
        /// <param name="range"></param>
        /// <returns></returns>
        public bool InRange( Point3D point3D, int iRange )
        {
            // (防止装箱操作)
            return ( point3D.X >= ( m_Location.X - iRange ) )
                && ( point3D.X <= ( m_Location.X + iRange ) )
                && ( point3D.Y >= ( m_Location.Y - iRange ) )
                && ( point3D.Y <= ( m_Location.Y + iRange ) );
        }

        /// <summary>
        /// 位置是否在范围内
        /// </summary>
        /// <param name="p"></param>
        /// <param name="range"></param>
        /// <returns></returns>
        public bool InRange( IPoint3D point3D, int iRange )
        {
            return InRange( point3D as IPoint2D, iRange );
        }

        /// <summary>
        /// 位置是否在范围内
        /// </summary>
        /// <param name="p"></param>
        /// <param name="range"></param>
        /// <returns></returns>
        public bool InRange( Point2D point2D, int iRange )
        {
            // (防止装箱操作)
            return ( point2D.X >= ( m_Location.X - iRange ) )
                && ( point2D.X <= ( m_Location.X + iRange ) )
                && ( point2D.Y >= ( m_Location.Y - iRange ) )
                && ( point2D.Y <= ( m_Location.Y + iRange ) );
        }

        /// <summary>
        /// 位置是否在范围内
        /// </summary>
        /// <param name="p"></param>
        /// <param name="range"></param>
        /// <returns></returns>
        public bool InRange( IPoint2D point2D, int iRange )
        {
            return ( point2D.X >= ( m_Location.X - iRange ) )
                && ( point2D.X <= ( m_Location.X + iRange ) )
                && ( point2D.Y >= ( m_Location.Y - iRange ) )
                && ( point2D.Y <= ( m_Location.Y + iRange ) );
        }
        #endregion

        #endregion

        #region zh-CHS 创建一个新的自身人物 | en Method
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private FastCreateInstanceHandler m_ConstructorInstance = null;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public BaseCreature CreateNewInstance()
        {
            if ( m_ConstructorInstance != null )
            {
                object returnObject = m_ConstructorInstance.Invoke();

                BaseCreature baseCreature = returnObject as BaseCreature;
                if ( baseCreature == null )
                {
                    Debug.WriteLine( "BaseCreature.CreateNewInstance(...) - baseCreature == null error!" );
                    return null;
                }

                return baseCreature;
            }
            else
            {
                m_ConstructorInstance = DynamicCalls.GetInstanceCreator( GetType() );
                if ( m_ConstructorInstance == null )
                {
                    Debug.WriteLine( "BaseCreature.CreateNewInstance(...) - m_ConstructorInstance == null error!" );
                    return null;
                }

                BaseCreature baseCreature = m_ConstructorInstance.Invoke() as BaseCreature;
                if ( baseCreature == null )
                {
                    Debug.WriteLine( "BaseCreature.CreateNewInstance(...) - baseCreature == null error!" );
                    return null;
                }

                return baseCreature;
            }
        }
        #endregion

        #region zh-CHS 人物的主处理行为 | en
        /// <summary>
        /// 
        /// </summary>
        public virtual void ProcessSlice()
        {
            EventHandler<BaseCreatureEventArgs> tempEventArgs = m_ThreadEventSlice;
            if ( tempEventArgs != null )
            {
                BaseCreatureEventArgs eventArgs = new BaseCreatureEventArgs( this );
                tempEventArgs( this, eventArgs );
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public static void UpdateSliceTo<thisT>( IUpdateSlice<thisT> updateSlice, thisT creatureT ) where thisT : BaseCreature
        {
            if ( updateSlice == null )
            {
                Debug.WriteLine( "BaseCreature.Slice(...) - updateSlice == null error!" );
                return;
            }
            
            if ( creatureT == null )
            {
                Debug.WriteLine( "BaseCreature.Slice(...) - creatureT == null error!" );
                return;
            }

            if ( creatureT.Deleted == true )
                return;

            updateSlice.UpdateSlice( creatureT );

            BaseWorld tempBaseWorld = creatureT.BaseWorld;
            if ( tempBaseWorld != null )
                tempBaseWorld.SetWorldSignal();
            else
                Debug.WriteLine( "BaseCreature.Slice(...) - tempBaseWorld == null error!" );
        }
        #endregion

        #endregion

        #region zh-CHS 接口实现 | en Interface Implementation

        /// <summary>
        /// 
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public int CompareTo( IEntity other )
        {
            if ( other == null )
                return 1;

            return m_Serial.CompareTo( other.Serial );
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public int CompareTo( BaseCreature other )
        {
            return CompareTo( other as IEntity );
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public int CompareTo( object xObject )
        {
            return CompareTo( xObject as IEntity );
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private SliceSupport m_SliceSupport = new SliceSupport();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public bool InSliceQueue()
        {
            return m_SliceSupport.InSliceQueue();
        }

        /// <summary>
        /// 
        /// </summary>
        public void OutSliceQueue()
        {
            m_SliceSupport.OutSliceQueue();
        }

        #endregion

        #region zh-CHS 方法覆盖 | en Override Methods
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return m_Name;
        }
        #endregion

        #region zh-CHS 共有事件 | en Public Event

        #region zh-CHS Slice事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BaseCreatureEventArgs> m_ThreadEventSlice;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventSlice = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BaseCreatureEventArgs> ThreadSlice
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventSlice );
                {
                    m_ThreadEventSlice += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventSlice );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventSlice );
                {
                    m_ThreadEventSlice -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventSlice );
            }
        }
        #endregion

        #region zh-CHS CreatureSave事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BaseCreatureEventArgs> m_ThreadEventCreatureSave;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventCreatureSave = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BaseCreatureEventArgs> ThreadCreatureSave
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventCreatureSave );
                {
                    m_ThreadEventCreatureSave += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventCreatureSave );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventCreatureSave );
                {
                    m_ThreadEventCreatureSave -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventCreatureSave );
            }
        }
        #endregion

        #region zh-CHS Serial事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateSerialEventArgs> m_ThreadEventBeforeUpdateSerial;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeUpdateSerial = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateSerialEventArgs> ThreadBeforeUpdateSerial
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateSerial );
                {
                    m_ThreadEventBeforeUpdateSerial += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateSerial );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateSerial );
                {
                    m_ThreadEventBeforeUpdateSerial -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateSerial );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateSerialEventArgs> m_ThreadEventAfterUpdateSerial;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterUpdateSerial = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateSerialEventArgs> ThreadAfterUpdateSerial
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateSerial );
                {
                    m_ThreadEventAfterUpdateSerial += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateSerial );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateSerial );
                {
                    m_ThreadEventAfterUpdateSerial -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateSerial );
            }
        }
        #endregion

        #region zh-CHS X事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateXEventArgs> m_ThreadEventBeforeUpdateX;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeUpdateX = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateXEventArgs> ThreadBeforeUpdateX
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateX );
                {
                    m_ThreadEventBeforeUpdateX += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateX );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateX );
                {
                    m_ThreadEventBeforeUpdateX -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateX );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateXEventArgs> m_ThreadEventAfterUpdateX;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterUpdateX = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateXEventArgs> ThreadAfterUpdateX
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateX );
                {
                    m_ThreadEventAfterUpdateX += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateX );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateX );
                {
                    m_ThreadEventAfterUpdateX -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateX );
            }
        }
        #endregion

        #region zh-CHS Y事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateYEventArgs> m_ThreadEventBeforeUpdateY;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeUpdateY = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateYEventArgs> ThreadBeforeUpdateY
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateY );
                {
                    m_ThreadEventBeforeUpdateY += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateY );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateY );
                {
                    m_ThreadEventBeforeUpdateY -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateY );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateYEventArgs> m_ThreadEventAfterUpdateY;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterUpdateY = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateYEventArgs> ThreadAfterUpdateY
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateY );
                {
                    m_ThreadEventAfterUpdateY += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateY );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateY );
                {
                    m_ThreadEventAfterUpdateY -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateY );
            }
        }
        #endregion

        #region zh-CHS Z事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateZEventArgs> m_ThreadEventBeforeUpdateZ;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeUpdateZ = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateZEventArgs> ThreadBeforeUpdateZ
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateZ );
                {
                    m_ThreadEventBeforeUpdateZ += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateZ );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateZ );
                {
                    m_ThreadEventBeforeUpdateZ -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateZ );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateZEventArgs> m_ThreadEventAfterUpdateZ;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterUpdateZ = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateZEventArgs> ThreadAfterUpdateZ
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateZ );
                {
                    m_ThreadEventAfterUpdateZ += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateZ );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateZ );
                {
                    m_ThreadEventAfterUpdateZ -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateZ );
            }
        }
        #endregion

        #region zh-CHS Orientation事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateOrientationEventArgs> m_ThreadEventBeforeUpdateOrientation;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeUpdateOrientation = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateOrientationEventArgs> ThreadBeforeUpdateOrientation
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateOrientation );
                {
                    m_ThreadEventBeforeUpdateOrientation += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateOrientation );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateOrientation );
                {
                    m_ThreadEventBeforeUpdateOrientation -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateOrientation );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateOrientationEventArgs> m_ThreadEventAfterUpdateOrientation;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterUpdateOrientation = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateOrientationEventArgs> ThreadAfterUpdateOrientation
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateOrientation );
                {
                    m_ThreadEventAfterUpdateOrientation += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateOrientation );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateOrientation );
                {
                    m_ThreadEventAfterUpdateOrientation -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateOrientation );
            }
        }
        #endregion

        #region zh-CHS Location事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateLocationEventArgs> m_ThreadEventBeforeUpdateLocation;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeUpdateLocation = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateLocationEventArgs> ThreadBeforeUpdateLocation
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateLocation );
                {
                    m_ThreadEventBeforeUpdateLocation += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateLocation );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateLocation );
                {
                    m_ThreadEventBeforeUpdateLocation -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateLocation );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateLocationEventArgs> m_ThreadEventAfterUpdateLocation;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterUpdateLocation = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateLocationEventArgs> ThreadAfterUpdateLocation
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateLocation );
                {
                    m_ThreadEventAfterUpdateLocation += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateLocation );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateLocation );
                {
                    m_ThreadEventAfterUpdateLocation -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateLocation );
            }
        }
        #endregion

        #region zh-CHS MoveToCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeMoveToCallEventArgs> m_ThreadEventBeforeMoveToCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeMoveToCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeMoveToCallEventArgs> ThreadBeforeMoveToCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeMoveToCall );
                {
                    m_ThreadEventBeforeMoveToCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeMoveToCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeMoveToCall );
                {
                    m_ThreadEventBeforeMoveToCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeMoveToCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterMoveToCallEventArgs> m_ThreadEventAfterMoveToCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterMoveToCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterMoveToCallEventArgs> ThreadAfterMoveToCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterMoveToCall );
                {
                    m_ThreadEventAfterMoveToCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterMoveToCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterMoveToCall );
                {
                    m_ThreadEventAfterMoveToCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterMoveToCall );
            }
        }
        #endregion

        #region zh-CHS MoveToWorldCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeMoveToWorldCallEventArgs> m_ThreadEventBeforeMoveToWorldCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeMoveToWorldCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeMoveToWorldCallEventArgs> ThreadBeforeMoveToWorldCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeMoveToWorldCall );
                {
                    m_ThreadEventBeforeMoveToWorldCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeMoveToWorldCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeMoveToWorldCall );
                {
                    m_ThreadEventBeforeMoveToWorldCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeMoveToWorldCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterMoveToWorldCallEventArgs> m_ThreadEventAfterMoveToWorldCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterMoveToWorldCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterMoveToWorldCallEventArgs> ThreadAfterMoveToWorldCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterMoveToWorldCall );
                {
                    m_ThreadEventAfterMoveToWorldCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterMoveToWorldCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterMoveToWorldCall );
                {
                    m_ThreadEventAfterMoveToWorldCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterMoveToWorldCall );
            }
        }
        #endregion

        #region zh-CHS Map事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateMapEventArgs> m_ThreadEventBeforeUpdateMap;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeUpdateMap = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateMapEventArgs> ThreadBeforeUpdateMap
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateMap );
                {
                    m_ThreadEventBeforeUpdateMap += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateMap );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateMap );
                {
                    m_ThreadEventBeforeUpdateMap -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateMap );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateMapEventArgs> m_ThreadEventAfterUpdateMap;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterUpdateMap = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateMapEventArgs> ThreadAfterUpdateMap
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateMap );
                {
                    m_ThreadEventAfterUpdateMap += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateMap );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateMap );
                {
                    m_ThreadEventAfterUpdateMap -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateMap );
            }
        }
        #endregion

        #region zh-CHS Name事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateNameEventArgs> m_ThreadEventBeforeUpdateName;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeUpdateName = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateNameEventArgs> ThreadBeforeUpdateName
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateName );
                {
                    m_ThreadEventBeforeUpdateName += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateName );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateName );
                {
                    m_ThreadEventBeforeUpdateName -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateName );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateNameEventArgs> m_ThreadEventAfterUpdateName;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterUpdateName = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateNameEventArgs> ThreadAfterUpdateName
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateName );
                {
                    m_ThreadEventAfterUpdateName += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateName );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateName );
                {
                    m_ThreadEventAfterUpdateName -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateName );
            }
        }
        #endregion

        #region zh-CHS CreatureTemplate事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateCreatureTemplateEventArgs> m_ThreadEventBeforeUpdateCreatureTemplate;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeUpdateCreatureTemplate = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateCreatureTemplateEventArgs> ThreadBeforeUpdateCreatureTemplate
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateCreatureTemplate );
                {
                    m_ThreadEventBeforeUpdateCreatureTemplate += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateCreatureTemplate );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateCreatureTemplate );
                {
                    m_ThreadEventBeforeUpdateCreatureTemplate -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateCreatureTemplate );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateCreatureTemplateEventArgs> m_ThreadEventAfterUpdateCreatureTemplate;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterUpdateCreatureTemplate = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateCreatureTemplateEventArgs> ThreadAfterUpdateCreatureTemplate
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateCreatureTemplate );
                {
                    m_ThreadEventAfterUpdateCreatureTemplate += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateCreatureTemplate );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateCreatureTemplate );
                {
                    m_ThreadEventAfterUpdateCreatureTemplate -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateCreatureTemplate );
            }
        }
        #endregion

        #region zh-CHS Loots事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateLootsEventArgs> m_ThreadEventBeforeUpdateLoots;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeUpdateLoots = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateLootsEventArgs> ThreadBeforeUpdateLoots
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateLoots );
                {
                    m_ThreadEventBeforeUpdateLoots += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateLoots );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateLoots );
                {
                    m_ThreadEventBeforeUpdateLoots -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateLoots );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateLootsEventArgs> m_ThreadEventAfterUpdateLoots;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterUpdateLoots = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateLootsEventArgs> ThreadAfterUpdateLoots
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateLoots );
                {
                    m_ThreadEventAfterUpdateLoots += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateLoots );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateLoots );
                {
                    m_ThreadEventAfterUpdateLoots -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateLoots );
            }
        }
        #endregion

        #region zh-CHS GoldLoots事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateGoldLootsEventArgs> m_ThreadEventBeforeUpdateGoldLoot;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeUpdateGoldLoot = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateGoldLootsEventArgs> ThreadBeforeUpdateGoldLoot
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateGoldLoot );
                {
                    m_ThreadEventBeforeUpdateGoldLoot += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateGoldLoot );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeUpdateGoldLoot );
                {
                    m_ThreadEventBeforeUpdateGoldLoot -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeUpdateGoldLoot );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateGoldLootsEventArgs> m_ThreadEventAfterUpdateGoldLoots;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterUpdateGoldLoots = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateGoldLootsEventArgs> ThreadAfterUpdateGoldLoots
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateGoldLoots );
                {
                    m_ThreadEventAfterUpdateGoldLoots += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateGoldLoots );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterUpdateGoldLoots );
                {
                    m_ThreadEventAfterUpdateGoldLoots -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterUpdateGoldLoots );
            }
        }
        #endregion

        #region zh-CHS DeathCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeDeathCallEventArgs> m_ThreadEventBeforeDeathCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeDeathCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeDeathCallEventArgs> ThreadBeforeDeathCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeDeathCall );
                {
                    m_ThreadEventBeforeDeathCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeDeathCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeDeathCall );
                {
                    m_ThreadEventBeforeDeathCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeDeathCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterDeathCallEventArgs> m_ThreadEventAfterDeathCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterDeathCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterDeathCallEventArgs> ThreadAfterDeathCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterDeathCall );
                {
                    m_ThreadEventAfterDeathCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterDeathCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterDeathCall );
                {
                    m_ThreadEventAfterDeathCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterDeathCall );
            }
        }
        #endregion

        #region zh-CHS RevivalCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeRevivalCallEventArgs> m_ThreadEventBeforeRevivalCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeRevivalCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeRevivalCallEventArgs> ThreadBeforeRevivalCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeRevivalCall );
                {
                    m_ThreadEventBeforeRevivalCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeRevivalCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeRevivalCall );
                {
                    m_ThreadEventBeforeRevivalCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeRevivalCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterRevivalCallEventArgs> m_ThreadEventAfterRevivalCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterRevivalCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterRevivalCallEventArgs> ThreadAfterRevivalCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterRevivalCall );
                {
                    m_ThreadEventAfterRevivalCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterRevivalCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterRevivalCall );
                {
                    m_ThreadEventAfterRevivalCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterRevivalCall );
            }
        }
        #endregion

        #region zh-CHS AddItemCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeAddItemCallEventArgs> m_ThreadEventBeforeAddItemCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeAddItemCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeAddItemCallEventArgs> ThreadBeforeAddItemCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeAddItemCall );
                {
                    m_ThreadEventBeforeAddItemCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeAddItemCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeAddItemCall );
                {
                    m_ThreadEventBeforeAddItemCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeAddItemCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterAddItemCallEventArgs> m_ThreadEventAfterAddItemCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterAddItemCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterAddItemCallEventArgs> ThreadAfterAddItemCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterAddItemCall );
                {
                    m_ThreadEventAfterAddItemCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterAddItemCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterAddItemCall );
                {
                    m_ThreadEventAfterAddItemCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterAddItemCall );
            }
        }
        #endregion

        #region zh-CHS RemoveItemCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeRemoveItemCallEventArgs> m_ThreadEventBeforeRemoveItemCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeRemoveItemCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeRemoveItemCallEventArgs> ThreadBeforeRemoveItemCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeRemoveItemCall );
                {
                    m_ThreadEventBeforeRemoveItemCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeRemoveItemCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeRemoveItemCall );
                {
                    m_ThreadEventBeforeRemoveItemCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeRemoveItemCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterRemoveItemCallEventArgs> m_ThreadEventAfterRemoveItemCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterRemoveItemCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterRemoveItemCallEventArgs> ThreadAfterRemoveItemCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterRemoveItemCall );
                {
                    m_ThreadEventAfterRemoveItemCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterRemoveItemCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterRemoveItemCall );
                {
                    m_ThreadEventAfterRemoveItemCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterRemoveItemCall );
            }
        }
        #endregion

        #region zh-CHS AddFriendCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeAddFriendCallEventArgs> m_ThreadEventBeforeAddFriendCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeAddFriendCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeAddFriendCallEventArgs> ThreadBeforeAddFriendCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeAddFriendCall );
                {
                    m_ThreadEventBeforeAddFriendCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeAddFriendCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeAddFriendCall );
                {
                    m_ThreadEventBeforeAddFriendCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeAddFriendCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterAddFriendCallEventArgs> m_ThreadEventAfterAddFriendCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterAddFriendCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterAddFriendCallEventArgs> ThreadAfterAddFriendCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterAddFriendCall );
                {
                    m_ThreadEventAfterAddFriendCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterAddFriendCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterAddFriendCall );
                {
                    m_ThreadEventAfterAddFriendCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterAddFriendCall );
            }
        }
        #endregion

        #region zh-CHS RemoveFriendCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeRemoveFriendCallEventArgs> m_ThreadEventBeforeRemoveFriendCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeRemoveFriendCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeRemoveFriendCallEventArgs> ThreadBeforeRemoveFriendCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeRemoveFriendCall );
                {
                    m_ThreadEventBeforeRemoveFriendCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeRemoveFriendCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeRemoveFriendCall );
                {
                    m_ThreadEventBeforeRemoveFriendCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeRemoveFriendCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterRemoveFriendCallEventArgs> m_ThreadEventAfterRemoveFriendCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterRemoveFriendCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterRemoveFriendCallEventArgs> ThreadAfterRemoveFriendCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterRemoveFriendCall );
                {
                    m_ThreadEventAfterRemoveFriendCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterRemoveFriendCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterRemoveFriendCall );
                {
                    m_ThreadEventAfterRemoveFriendCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterRemoveFriendCall );
            }
        }
        #endregion

        #region zh-CHS AddGroupCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeAddGroupCallEventArgs> m_ThreadEventBeforeAddGroupCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeAddGroupCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeAddGroupCallEventArgs> ThreadBeforeAddGroupCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeAddGroupCall );
                {
                    m_ThreadEventBeforeAddGroupCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeAddGroupCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeAddGroupCall );
                {
                    m_ThreadEventBeforeAddGroupCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeAddGroupCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterAddGroupCallEventArgs> m_ThreadEventAfterAddGroupCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterAddGroupCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterAddGroupCallEventArgs> ThreadAfterAddGroupCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterAddGroupCall );
                {
                    m_ThreadEventAfterAddGroupCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterAddGroupCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterAddGroupCall );
                {
                    m_ThreadEventAfterAddGroupCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterAddGroupCall );
            }
        }
        #endregion

        #region zh-CHS RemoveGroupCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeRemoveGroupCallEventArgs> m_ThreadEventBeforeRemoveGroupCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeRemoveGroupCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeRemoveGroupCallEventArgs> ThreadBeforeRemoveGroupCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeRemoveGroupCall );
                {
                    m_ThreadEventBeforeRemoveGroupCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeRemoveGroupCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeRemoveGroupCall );
                {
                    m_ThreadEventBeforeRemoveGroupCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeRemoveGroupCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterRemoveGroupCallEventArgs> m_ThreadEventAfterRemoveGroupCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterRemoveGroupCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterRemoveGroupCallEventArgs> ThreadAfterRemoveGroupCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterRemoveGroupCall );
                {
                    m_ThreadEventAfterRemoveGroupCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterRemoveGroupCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterRemoveGroupCall );
                {
                    m_ThreadEventAfterRemoveGroupCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterRemoveGroupCall );
            }
        }
        #endregion

        #region zh-CHS AddPartyCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeAddPartyCallEventArgs> m_ThreadEventBeforeAddPartyCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeAddPartyCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeAddPartyCallEventArgs> ThreadBeforeAddPartyCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeAddPartyCall );
                {
                    m_ThreadEventBeforeAddPartyCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeAddPartyCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeAddPartyCall );
                {
                    m_ThreadEventBeforeAddPartyCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeAddPartyCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterAddPartyCallEventArgs> m_ThreadEventAfterAddPartyCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterAddPartyCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterAddPartyCallEventArgs> ThreadAfterAddPartyCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterAddPartyCall );
                {
                    m_ThreadEventAfterAddPartyCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterAddPartyCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterAddPartyCall );
                {
                    m_ThreadEventAfterAddPartyCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterAddPartyCall );
            }
        }
        #endregion

        #region zh-CHS RemovePartyCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeRemovePartyCallEventArgs> m_ThreadEventBeforeRemovePartyCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeRemovePartyCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeRemovePartyCallEventArgs> ThreadBeforeRemovePartyCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeRemovePartyCall );
                {
                    m_ThreadEventBeforeRemovePartyCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeRemovePartyCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeRemovePartyCall );
                {
                    m_ThreadEventBeforeRemovePartyCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeRemovePartyCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterRemovePartyCallEventArgs> m_ThreadEventAfterRemovePartyCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterRemovePartyCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterRemovePartyCallEventArgs> ThreadAfterRemovePartyCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterRemovePartyCall );
                {
                    m_ThreadEventAfterRemovePartyCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterRemovePartyCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterRemovePartyCall );
                {
                    m_ThreadEventAfterRemovePartyCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterRemovePartyCall );
            }
        }
        #endregion

        #region zh-CHS DeleteCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BaseCreatureEventArgs> m_ThreadEventBeforeDeleteCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventBeforeDeleteCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BaseCreatureEventArgs> ThreadBeforeDeleteCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeDeleteCall );
                {
                    m_ThreadEventBeforeDeleteCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeDeleteCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventBeforeDeleteCall );
                {
                    m_ThreadEventBeforeDeleteCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventBeforeDeleteCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BaseCreatureEventArgs> m_ThreadEventAfterDeleteCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockThreadEventAfterDeleteCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BaseCreatureEventArgs> ThreadAfterDeleteCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterDeleteCall );
                {
                    m_ThreadEventAfterDeleteCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterDeleteCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockThreadEventAfterDeleteCall );
                {
                    m_ThreadEventAfterDeleteCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockThreadEventAfterDeleteCall );
            }
        }
        #endregion

        #endregion
    }
}
#endregion